<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login_model extends CI_Model {

	function validate(){		
		$this->db->where('username', $this->input->post('username') );
		$this->db->where('password', md5($this->input->post('password') ) );
		$query = $this->db->get('users');

		if ($query->num_rows == 1) {
			foreach ($query->result() as $user) {
				$data = array('is_logged_in' => true, 'username' => $user->first_name, 'id' => $user->id);
				return $data;
			}
		}else{
			return false;
		}
	}

}

/* End of file login_model.php */
/* Location: ./application/models/login_model.php */